package Core;

public class CharacterImpl implements Character
{
	private double _currentMana;
	private double _maxMana;
	private double _currentActionPoints;
	private double _maxActionPoints;
	private double _currentHitPoints;
	private double _maxHitPoints;
	
	private CharacterCareer _career;
		
	public CharacterImpl(CharacterCareer career)
	{
		this._career = career;
	}
	
	@Override
	public double getCurrentHitPoints()
	{
		return this._currentHitPoints;
	}
	
	@Override
	public void setCurrentHitPoints(double newHp)
	{
		if (newHp > this._maxHitPoints)
		{
			newHp = this._maxHitPoints;
		}
		
		this._currentHitPoints = newHp;
	}
	
	@Override
	public void subtractHitPoints(double amountToSubtract)
	{
		this.setCurrentHitPoints(this.getCurrentHitPoints() - amountToSubtract);
	}
	
	@Override
	public double getMaxHitPoints()
	{
		return this._maxHitPoints;
	}
	
	@Override
	public void setMaxHitPoints(double newMax)
	{
		this._maxHitPoints = newMax;
	}
	
	@Override
	public void increaseMaxHitPoints(double amount)
	{
		this.setMaxHitPoints(this.getMaxHitPoints() + amount);
	}
	
	@Override
	public double getCurrentMana()
	{
		return this._currentMana;
	}
	
	@Override
	public void setCurrentMana(double newMana)
	{
		double maxMana = this.getMaxMana();
		
		if (newMana > maxMana)
		{
			newMana = maxMana;
		}
		
		this._currentMana = newMana;
	}
	
	@Override
	public double getMaxMana()
	{
		return this._maxMana;
	}
	
	@Override
	public void setMaxMana(double newMax)
	{
		this._maxMana = newMax;
	}
	
	@Override
	public void increaseMaxMana(double amount)
	{
		this.setMaxMana(this.getMaxMana() + amount);
	}
	
	@Override
	public void subtractMana(double manaToSubtract)
	{
		this.setCurrentMana(this._currentMana - manaToSubtract);
	}
	
	@Override
	public double getCurrentActionPoints()
	{
		return this._currentActionPoints;
	}
	
	@Override
	public void setCurrentActionPoints(double newActionPoints)
	{
		double maxActionPoints = this.getMaxActionPoints();
		
		if (newActionPoints > maxActionPoints)
		{
			newActionPoints = maxActionPoints;
		}
		
		this._currentActionPoints = newActionPoints;
	}
	
	@Override
	public void subtractActionPoints(double actionPointsToSubtract)
	{
		this.setCurrentActionPoints(this._currentActionPoints - actionPointsToSubtract);
	}
	
	@Override
	public double getMaxActionPoints()
	{
		return this._maxActionPoints;
	}
	
	@Override
	public void setMaxActionPoints(double newMaxActionPoints)
	{
		this._maxActionPoints = newMaxActionPoints;
	}
	
	@Override
	public CharacterCareer getCareer()
	{
		return this._career;
	}
	
	@Override
	public int getLevelsIn(CharacterClass characterClass)
	{
		return this._career.getLevelsIn(characterClass);
	}
}
